﻿/*-------------------------------------------------------
 * Author : Tharinduni Udugamasuriya
 * Date : July 2014
 * IMasterWriteService : Interface of WriteService
 ------------------------------------------------------*/

using System;
using System.Data;
using System.Data.SqlClient;

namespace DSPL.Contracts.Interfaces
{
    public interface IWriteService
    {
        int PrimaryKey { get; set; }

        string ReferenceNo { get; set; }

        bool InsertMasterData(string tablename, string primaryKedField, DataRow newDataRow, ref SqlTransaction sqlTran);

        bool UpdateMasterData(string tableName, string primaryKedField,string logTableName, DataRow newDataRow, DataRow oldDataRow, ref SqlTransaction sqlTran);

        bool DeleteMasterData(string tableName,string primaryKedField, string logTableName, DataRow oldDataRow, ref SqlTransaction sqlTran);

        bool InsertTransactionData(string parentTableName, string childTableName, string primaryKeyField, string refNoKedField, DataRow newDataRow,
            DataTable childDataTable, ref SqlTransaction sqlTran, string settingCode, DateTime? txnDate = null, string branch = null);

        bool UpdateTransactionData(string parentTableName, string childTableName, string primaryKeyField, string refNoKedField,
            string logParentTable, string logChildTable, DataRow newDataRow, DataRow oldDataRow, DataTable oldChildDataTable, DataTable newChildDataTable,
            ref  SqlTransaction sqlTran, string settingCode, DateTime? txnDate = null, string branch = null);

        bool DeleteTransactionData(string parentTableName, string childTableName, string primaryKeyField, string logParentTableName, string logChildTableName,
            DataRow oldDataRow, DataTable oldChildDataTable, ref  SqlTransaction sqlTran);

    }
}
